package sample.util;

import javafx.scene.control.Label;
import sample.controller.Controller;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by lenovo on 2017/1/6.
 */
public class TimeAndDate {
    public static void getTime(final Label showTime){
        new Thread(new Runnable(){
            @Override
            public void run() {
               while(true){
                   Date now=new Date();
                   SimpleDateFormat sdf=new SimpleDateFormat("HH:mm:ss");
                   String nowTime=sdf.format(now);
                   showTime.setText(nowTime);
                   dearyTime(1);
               }
            }
        }).start();
    }
    public static void dearyTime(int time){
        try {
            Thread.sleep(time*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
